package net.nagaseyasuhito.nicola.page;

import net.nagaseyasuhito.nicola.NicolaSession;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.Link;

public abstract class BasePage extends WebPage {
	public BasePage() {
		this.add(new BookmarkablePageLink("index", IndexPage.class));
		this.add(new BookmarkablePageLink("home", MyPage.class));
		this.add(new BookmarkablePageLink("signUp", SignUpPage.class).setVisible(!NicolaSession.get().isSignedIn()));
		this.add(new Link("signOut") {
			private static final long serialVersionUID = 1L;

			@Override
			public void onClick() {
				NicolaSession.get().signOut();
				this.setResponsePage(IndexPage.class);
			}
		}.setVisible(NicolaSession.get().isSignedIn()));
	}
}
